package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.Drivers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PublicPriceMapper;
import com.ruoyi.system.domain.PublicPrice;
import com.ruoyi.system.service.IPublicPriceService;

/**
 * 商品价格Service业务层处理
 * 
 * @author he
 * @date 2025-08-13
 */
@Service
public class PublicPriceServiceImpl implements IPublicPriceService 
{
    @Autowired
    private PublicPriceMapper publicPriceMapper;

    /**
     * 查询商品价格
     * 
     * @param id 商品价格主键
     * @return 商品价格
     */
    @Override
    public PublicPrice selectPublicPriceById(Long id)
    {
        return publicPriceMapper.selectPublicPriceById(id);
    }

    /**
     * 查询商品价格列表
     * 
     * @param publicPrice 商品价格
     * @return 商品价格
     */
    @Override
    public List<PublicPrice> selectPublicPriceList(PublicPrice publicPrice)
    {
        return publicPriceMapper.selectPublicPriceList(publicPrice);
    }

    /**
     * 新增商品价格
     * 
     * @param publicPrice 商品价格
     * @return 结果
     */
    @Override
    public int insertPublicPrice(PublicPrice publicPrice)
    {
    publicPrice.setCreateUserId(SecurityUtils.getUserId());
    publicPrice.setCreateUserName(SecurityUtils.getUsername());
        publicPrice.setCreateTime(DateUtils.getNowDate());
        return publicPriceMapper.insertPublicPrice(publicPrice);
    }

    /**
     * 修改商品价格
     * 
     * @param publicPrice 商品价格
     * @return 结果
     */
    @Override
    public int updatePublicPrice(PublicPrice publicPrice)
    {
        publicPrice.setUpdateTime(DateUtils.getNowDate());
    publicPrice.setUpdateUserId(SecurityUtils.getUserId());
    publicPrice.setUpdateUserName(SecurityUtils.getUsername());
        return publicPriceMapper.updatePublicPrice(publicPrice);
    }

    /**
     * 批量删除商品价格
     * 
     * @param ids 需要删除的商品价格主键
     * @return 结果
     */
    @Override
    public int deletePublicPriceByIds(Long[] ids)
    {
        return publicPriceMapper.deletePublicPriceByIds(ids);
    }

    /**
     * 删除商品价格信息
     * 
     * @param id 商品价格主键
     * @return 结果
     */
    @Override
    public int deletePublicPriceById(Long id)
    {
        return publicPriceMapper.deletePublicPriceById(id);
    }

    @Override
    public List<Drivers> getGoodsPriceInfoList(String paramName) {
        return publicPriceMapper.getGoodsPriceInfoList(paramName);
    }
}
